<?php

session_start();

include("common/common.php");
$_lang=null;
$_user=null;
$isfb=null;

if (isset($_COOKIE['facebook'])){
	$isfb=$_COOKIE['facebook'];
}

if(isset($_GET['language']) ){
	if($_GET['language']==FR||$_GET['language']==ARB){
		$_lang=$_GET['language'];
	}
}
if (is_null($_lang) and isset($_COOKIE['_lang'])){
	$_lang=$_COOKIE['_lang'];
}else{
	if(is_null($_lang)){
		$_lang = FR;
		}
}
//$_lang = FR;
setcookie('_lang', $_lang,time()+315360000);
// $_SESSION['_lang']=$_lang;	

if (is_null($_user) and isset($_COOKIE['_user'])){
$_user=$_COOKIE['_user'];
}
$curl = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'];
$_SESSION['currenturl']=$curl;

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>kacho-resto</title>
<meta name="keywords" content="kacho">
<?php if($_lang==FR){ ?>
<link rel="stylesheet" type="text/css" href="css/style.css">
<?php }?>
<?php if($_lang==ARB){ ?>
<link rel="stylesheet" type="text/css" href="css/stylearb.css">
<?php }?>
<link rel="stylesheet" href="js/themes/base/jquery.ui.all.css">
<link rel="stylesheet" href="css/flexslider.css" type="text/css" media="screen" />

</head>

<!--body-->
<body style="width:1440px;background:url(images/homeBg.png)  repeat-y;">
<div  id="warp"  class="warp">
<div class="header">
 <div class="head">
   <h1 class="logo fl"><a href="index.php"></a></h1>
   <div class="marquee">
     <div id="demo" style="overflow:hidden;height:24px; line-height:24px;width:490px;white-space:nowrap;">
      <div id="demo1">    
      <?php if($_lang==FR){ ?>
      Votre 1er site web franco-arabe dédié au monde de l'alimentation et de la restauration méditérranéenne. 
      <?php }?>
      <?php if($_lang==ARB){ ?>
      موقعكم الوحيد باللغة العربية لعالم المأكولات والضيافة المغربية والشرق أوسطية
      <?php }?>       
      </div>
     <div id="demo2"></div>
   </div>
  </div>
   <div class="lauang">
    <ul>
	  <?php if(true){ if($_lang==FR){ ?>
      <li><label style="color:#a1c104">Français</label> | </li>
      <?php }else{?>
      <li><a href="<?= $curl ?>&language=<?=FR?>">Français</a> | </li>
      <?php }?>
      <?php if($_lang==ARB){ ?>
      <li><label style="color:#a1c104">عربي</label></li>
      <?php }else{?>
      <li><a href="<?= $curl ?>&language=<?=ARB?>">عربي</a></li>
      <?php }}?>
    </ul>
   </div>
   <div class="inf">
    <ul>
	   
     <?php 
     if (is_null($_user)){
    	 if($_lang==FR){ 
     ?>
	  <li onclick="login()"><i class="login"></i>S'identifier</li>
      <li onclick="reg()"><i class="jion"></i>S'inscrire</li>
      <?php }?>
      <?php if($_lang==ARB){ ?>
	  <li onclick="login()"><i class="login"></i>تسجيل الدخول</li>
      <li onclick="reg()"><i class="jion"></i>تسجيل حساب جديد</li>
      <?php 
     	}
     }else{
      ?>
      <?php if(is_null($isfb)){?>
      <li id="login"><i class="login"></i><?=get_local_value($_lang,"user")?>
       <div class="loginDl">
          <dl>
            <dd><a href="user.php"><?=get_local_value($_lang,"userpage")?></a></dd> 
            <dd><a href="decon.php"><?=get_local_value($_lang,"logout")?></a></dd>    
          </dl>
       </div> 
      </li>
      <?php }else{?>
      <li><i class="login"></i><a href="javascript:logout()" style="color:#999"><?=get_local_value($_lang,"logout")?></a></li>
      <?php }?>
      <?php }?>
     </ul>
    </div>

   <!--inf end of-->
   <div class="search">
     <form id="searchform" action="searchedrestos.php" method="post">
     <ul>
       <li><input name="searchkey" type="text" class="inputBg" value="Nom de restaurant, code postal"  onclick="if(value==defaultValue){value='';this.style.color='#fff'}" onBlur="if(!value){value=defaultValue;this.style.color='#999'}"/></li>
       <!--li><input name="" type="text" class="inputBg" value="Nom de restaurant, code postal"  /></li-->
       <li><input name="bt" type="button" class="searchBtn" value="" onclick="javascript:document.getElementById('searchform').submit();"/></li>
     </ul>
     </form>
   </div>
   <div class="nav">
   <?php 
   	$menutag=1;
   	if(isset($_GET["menu"])){
   		$menutag = $_GET["menu"];
   	}
   ?>
     <ul>
     <?php if($menutag==1){?>
       <li><a href="index.php?menu=1" class="homeHover"></a></li>
     <?php }else{?>
       <li><a href="index.php?menu=1" class="home"></a></li>
     <?php }?>
     <?php if($menutag==2){?>
       <li><a href="qui.php?menu=2" class="quiHover"></a></li>
     <?php }else{?>
       <li><a href="qui.php?menu=2" class="qui"></a></li>
     <?php }?>
     <?php if($menutag==3){?>
       <li><a href="kac.php?menu=3" class="kacHover"></a></li>
     <?php }else{?>
       <li><a href="kac.php?menu=3" class="kac"></a></li>
     <?php }?>
     <?php if($menutag==4){?>
        <li><a href="contact.php?menu=4" class="nousHover"></a></li>
     <?php }else{?>
        <li><a href="contact.php?menu=4" class="nous"></a></li>
     <?php }?>
       
       
      
     </ul>
   </div>
   <!--nav end of-->
 </div>
</div>
<script type="text/javascript" src="js/jquery-1.4.min.js"></script>
<script type="text/javascript" src="js/jquery.dialog.js"></script>
<script type="text/javascript" src="js/select.js"></script>
<script type="text/javascript" src="js/form.js"></script>
<script type="text/javascript">

function login(){	
	var log1 = document.getElementById("logwindow1");
	var log2 = document.getElementById("logwindow2");
	
	log1.style.display = "";
	log2.style.display = "";
}

function logout(){
	FB.logout();
	window.location.href="decon.php";
}

function closelogin(){
	var log1 = document.getElementById("logwindow1");
	var log2 = document.getElementById("logwindow2");
	log1.style.display = "none";
	log2.style.display = "none";
}

function reg()
{
	var reg1 = document.getElementById("regwindow1");
	var reg2 = document.getElementById("regwindow2");
	
	reg1.style.display = "";
	reg2.style.display = "";
}

function closereg(){
	var reg1 = document.getElementById("regwindow1");
	var reg2 = document.getElementById("regwindow2");
	reg1.style.display = "none";
	reg2.style.display = "none";
}

function showSendPwd(){
	closelogin();
	var sd1 = document.getElementById("sendwindow1");
	var sd2 = document.getElementById("sendwindow2");
	
	sd1.style.display = "";
	sd2.style.display = "";
}
function closeSendPwd(){
	var sd1 = document.getElementById("sendwindow1");
	var sd2 = document.getElementById("sendwindow2");
	
	sd1.style.display = "none";
	sd2.style.display = "none";
}
function closeSendOk(){
	var sdok1 = document.getElementById("sendok1");
	var sdok2 = document.getElementById("sendok2");
	
	sdok1.style.display = "none";
	sdok2.style.display = "none";
}



$(function() {
$("#login").hover(
  function () {
	$(".loginDl").show();
  },
  function () {
	$(".loginDl").hide();
  }
);
});

</script>
<script style="text/javascript">

var speed=40;//数值越大，速度越慢
var demo2=document.getElementById("demo2");
var demo1=document.getElementById("demo1");
var demo=document.getElementById("demo");
demo2.innerHTML=demo1.innerHTML;
function MarqueeLeft(){
if(demo2.offsetWidth-demo.scrollLeft<=-110){
demo.scrollLeft-=(demo1.offsetWidth+110);
}else{
demo.scrollLeft++;
}
}

function MarqueeRight(){   
	if(demo.scrollLeft<=0){   
	   demo.scrollLeft+=demo2.offsetWidth;
	}
	else{   
	   demo.scrollLeft--;   
	}   
}   
<?php if($_lang==FR){ ?>
var MyMar=setInterval(MarqueeLeft,speed);
demo.onmouseover=function() {clearInterval(MyMar);}
demo.onmouseout=function() {MyMar=setInterval(MarqueeLeft,speed);}
<?php }?>
<?php if($_lang==ARB){ ?>
var MyMar=setInterval(MarqueeRight,speed);
demo.onmouseover=function() {clearInterval(MyMar);}
demo.onmouseout=function() {MyMar=setInterval(MarqueeRight,speed);}
<?php }?>
</script>
<script type="text/javascript">
function form_sub() 
{ 
	var ok = true;
	if(!test_email(document.getElementById("email").value)) 
	{ 
		document.getElementById("lemail").style.color="Red";
		ok = false; 
	}else{
		document.getElementById("lemail").style.color="Black";
	}
	if(!test_null(document.getElementById("nom").value)) 
	{ 
		document.getElementById("lnom").style.color="Red";
		ok = false;  
	}else{
		document.getElementById("lnom").style.color="Black";
	}
	if(!test_null(document.getElementById("prenom").value)) 
	{ 
		document.getElementById("lprenom").style.color="Red";
		ok = false;  
	}else{
		document.getElementById("lprenom").style.color="Black";
	}
	if(!IsNum(document.getElementById("zip").value)) 
	{ 
		document.getElementById("lzip").style.color="Red";
		ok = false;  
	}else{
		document.getElementById("lzip").style.color="Black";
	}
	if(!test_null(document.getElementById("tel").value)) 
	{ 
		document.getElementById("ltel").style.color="Red";
		ok = false;  
	}else{
		document.getElementById("ltel").style.color="Black";
	}

	if(!test_password(document.getElementById("passwd").value,document.getElementById("repasswd").value)) 
	{ 
		document.getElementById("lpasswd").style.color="Red";
		document.getElementById("lrepasswd").style.color="Red";
		ok = false;  
	}else{
		document.getElementById("lpasswd").style.color="Black";
		document.getElementById("lrepasswd").style.color="Black";
	}

	if(ok){
		document.getElementById("regform").submit();
	}
} 
</script>

<script>
  window.fbAsyncInit = function() {
  FB.init({
    appId      : '380526798717439', // App ID
    channelUrl : '//www.kacho-resto.com/channel.html', // Channel File
    status     : true, // check login status
    cookie     : true, // enable cookies to allow the server to access the session
    xfbml      : true  // parse XFBML
  });

  };
  // Load the SDK asynchronously
  (function(d){
   var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
   if (d.getElementById(id)) {return;}
   js = d.createElement('script'); js.id = id; js.async = true;
   js.src = "//connect.facebook.net/fr_FR/all.js";
   ref.parentNode.insertBefore(js, ref);
  }(document));

  function loginfb() {
	  FB.login(function(response) {
		  if (response.authResponse) {
			  FB.api('/me', function(response) {
			    	setCookie('_user', response.email,30);
			    	setCookie('facebook', response.email,30);
			    	 window.location.href="index.php";
			    });
		  }
		 }, {scope: 'email'});
	  
    
  }

  function setCookie(c_name,value,expiredays)
  {
  var exdate=new Date()
  exdate.setDate(exdate.getDate()+expiredays)
  document.cookie=c_name+ "=" +escape(value)+
  ((expiredays==null) ? "" : ";expires="+exdate.toGMTString())
  }
</script>


<div id="regwindow1" class="reg" style="display: none">
  <div id="regwindow2" class="regContent"  style="display: none">
    <a href="javascript:closereg();" class="closeReg" title=""></a>
    <dl>
      <dt><?=get_local_value($_lang,"reg")?></dt>
      <dd><a href="javascript:loginfb()" class="faceBook"></a></dd>
    </dl>
    <ul>
    <?php if($_lang==FR){ ?>
      <form id="regform" action="reged.php" method="post">
        <li><label id="lemail"><?=get_local_value($_lang,"email")?></label> <input  id="email" name="email" type="text" class="emailInput" style="color:#999;width:246px;"/></li>
        <li><label id="lpasswd"><?=get_local_value($_lang,"passwd")?></label> <input id="passwd" name="passwd" type="text" class="passeInput" style="color:#999;width:197px;" value="5 caractères minimum" onclick="if(value==defaultValue){value='';this.type='password';this.style.color='#000'}" onBlur="if(!value){value=defaultValue;this.type='text';this.style.color='#999'}" /></li>
        <li><label id="lrepasswd"><?=get_local_value($_lang,"passwd")?></label> <input id="repasswd" name="repasswd" type="text" class="passeInput" style="color:#999;width:197px;" value="Confirmation" onclick="if(value==defaultValue){value='';this.type='password';this.style.color='#000'}" onBlur="if(!value){value=defaultValue;this.type='text';this.style.color='#999'}" /></li>
        <li><?=get_local_value($_lang,"sex")?>&nbsp; 
			<select name="sex">
				<option value="1"><?=get_local_value($_lang,"male")?></option>
				<option value="2"><?=get_local_value($_lang,"female")?></option>
			</select></li>
        <li><label id="lnom"><?=get_local_value($_lang,"nom")?></label> <input id="nom" name="nom" type="text" class="emailInput"/></li>
        <li><label id="lprenom"><?=get_local_value($_lang,"prenom")?></label> <input id="prenom" name="prenom" type="text" class="postalInput" /></li>
        <li><label id="lzip"><?=get_local_value($_lang,"zip")?></label> <input id="zip" name="zip" type="text" class="emailInput" style="width: 205px" /></li>
        <li><label id="ltel"><?=get_local_value($_lang,"tel")?></label> <input id="tel" name="tel" type="text" class="emailInput" style="width: 167px" /></li>
        <li><input name="" type="button"  onClick="form_sub()" class="regBtn" /></li>
      </form>
      <?php }else{?>
      <form id="regform" action="reged.php" method="post">
        <li><label id="lemail"><?=get_local_value($_lang,"email")?></label> <input  id="email" name="email" type="text" class="emailInput" style="width:181px" /></li>
        <li><label id="lpasswd"><?=get_local_value($_lang,"passwd")?></label> <input id="passwd" name="passwd" type="text" class="passeInput" style="color:#999;" value="5 caractères minimum" onclick="if(value==defaultValue){value='';this.type='password';this.style.color='#000'}" onBlur="if(!value){value=defaultValue;this.type='text';this.style.color='#999'}" /></li>
        <li><label id="lrepasswd"><?=get_local_value($_lang,"passwd")?></label> <input id="repasswd" name="repasswd" type="text" class="passeInput" style="color:#999;" value="Confirmation" onclick="if(value==defaultValue){value='';this.type='password';this.style.color='#000'}" onBlur="if(!value){value=defaultValue;this.type='text';this.style.color='#999'}" /></li>
        <li><?=get_local_value($_lang,"sex")?>&nbsp; 
			<select name="sex">
				<option value="1"><?=get_local_value($_lang,"male")?></option>
				<option value="2"><?=get_local_value($_lang,"female")?></option>
			</select></li>
        <li><label id="lnom"><?=get_local_value($_lang,"nom")?></label> <input id="nom" name="nom" type="text" class="emailInput" style="width: 199px" /></li>
        <li><label id="lprenom"><?=get_local_value($_lang,"prenom")?></label> <input id="prenom" name="prenom" type="text" class="emailInput" style="width: 230px" /></li>
        <li><label id="lzip"><?=get_local_value($_lang,"zip")?></label> <input id="zip" name="zip" type="text" class="emailInput" style="width: 193px" /></li>
        <li><label id="ltel"><?=get_local_value($_lang,"tel")?></label> <input id="tel" name="tel" type="text" class="emailInput" style="width: 177px" /></li>
        <li><input name="" type="button"  onClick="form_sub()" class="regBtn" /></li>
      </form>
      <?php }?>
    </ul>
  </div>
</div>
<?php
$ltag=null;
if (isset($_SESSION["logtag"])){
	$ltag = $_SESSION["logtag"];
	$_SESSION["logtag"] = null;
}

?>
<div id="logwindow1" class="loginbg" <?php if ($ltag!=1){?>style="display: none"<?php }?>>
  <div id="logwindow2" class="loginContent"  <?php if ($ltag!=1){?>style="display: none"<?php }?>>
    <a href="javascript:closelogin()" class="closeLogin" title=""></a>
    <dl>
      <dt><?=get_local_value($_lang,"login")?></dt>
      <dd><a href="javascript:loginfb()" class="faceBook"></a></dd>
    </dl>
    <ul>
       <form action="conned.php" method="post">
      		<?php if ($ltag==1){?>
       		<li><font color="red"><?=get_local_value($_lang,"logerror")?></font></li>
       		<?php }?>
        	<li style="margin:5px 0 20px 0"><?=get_local_value($_lang,"email")?> 
        	<?php  if($_lang==FR){?>
        	<input name="email" type="text" class="emailInput" style="width:247px" />
        	<?php }else{?>
        	<input name="email" type="text" class="emailInput" style="width:180px" />
        	<?php }?>
        	</li>
        	<li style="margin-bottom:5px"><?=get_local_value($_lang,"passwd")?> <input name="passwd" type="text" class="passeInput" style="color:#999;" value="5 caractères minimum" onclick="if(value==defaultValue){value='';this.type='password';this.style.color='#000'}" onBlur="if(!value){value=defaultValue;this.type='text';this.style.color='#999'}" /></li>
        	<li style="margin-bottom:5px"><i><a href="javascript:showSendPwd();" style="padding-left:170px;margin:0px"><?=get_local_value($_lang,"forget")?></a></i></li>
        	<li style="margin-bottom:20px"><input name="" type="checkbox" value="" /> &nbsp;<?=get_local_value($_lang,"remember")?></li>
        	<li><input name="" type="submit" value="" class="loginBtn" /></li>
      </form>
    </ul>
  </div>
</div>

<?php
$sptag=null;
if (isset($_SESSION["sendpwdtag"])){
	$sptag = $_SESSION["sendpwdtag"];
	$_SESSION["sendpwdtag"] = null;
}

?>

<div id="sendok1" class="loginbg" <?php if ($sptag!=1){?>style="display: none"<?php }?>>
  <div id="sendok2" class="loginContent" <?php if ($sptag!=1){?>style="display: none"<?php }?>>
    <a href="javascript:closeSendOk();" class="closeLogin" title=""></a>
    <dl>
    <?php if($_lang==FR){?>
      <dd class="font" style="margin-top:20px">Nouveau mot de passe<br/>envoyé !</dd>
      <dd class="font"></dd>
      <?php }else{?>
       <dt>إرسال كلمة المرور الجديدة</dt>
      <?php }?>
    </dl>
    <ul>
        <?php if($_lang==FR){?>
      		<li style="margin-bottom:20px;text-align:justify;">Un nouveau mot de passe vous a été envoyé à l'adresse email que vous avez saisie lors de la création de votre compte.</li>
        	<li style="margin-bottom:20px;text-align:justify;">Nous vous conseillons de le changer dans la gestion de votre compte après vous être identifié.</li>
        <?php }else{?>
        	<li style="margin-bottom:20px;margin-right:20px;text-align:right;direction: rtl">تم إرسال كلمة المرور الجديدة على بريدكم
 الإلكتروني، ألأفضل تغيرها وإستعمال كلمة مرور
  أخرى.
   			</li>
        <?php }?>
      </form>
    </ul>
  </div>
</div>




<div id="sendwindow1" class="loginbg" style="display: none">
  <div id="sendwindow2" class="loginContent" style="display: none">
    <a href="javascript:closeSendPwd();" class="closeLogin" title=""></a>
    <dl>
    <?php if($_lang==FR){?>
      <dd class="font" style="margin-top:20px">Vous avez oublié<br/>votre mot de passe ?</dd>
      <dd></dd>
      <?php }else{?>
      <dt> قد نسيتم كلمة المرور الخاصة بكم ؟</dt>
      <?php }?>
    </dl>
    <ul>
       <form action="forgetpwd.php" method="post">
        <?php if($_lang==FR){?>
      		<li style="margin-bottom:20px;text-align:justify;">Pour recevoir par email un nouveau mot de passe, entrez ci-dessous l'email avec lequel vous avez créé votre compte sur le site.</li>
        <?php }else{?>
        	<li style="margin-right:20px;margin-bottom:20px;text-align:right;direction: rtl"> للحصول على كلمة المرور يرجى إدخال البريد الإلكتروني ألأساسي.</li>
        <?php }?>
        	<li style="margin:5px 0 20px 0"><?=get_local_value($_lang,"email")?> <input name="pwdemail" type="text" class="emailInput" /></li>
        	<li><input name="" type="submit" value="" class="forgetBtn" /></li>
      </form>
    </ul>
  </div>
</div>

<div style="position:absolute; left:15px; top:260px"><a href="http://www.marriottchampselysees.com" target="_blank"><img width="140" height="80" src="images/logo/marriott.png"></img></a></div>
<div style="position:absolute; left:15px; top:380px"><a href="http://www.lesmerveillesdumaroc.fr" target="_blank"><img width="140" height="80" src="images/logo/lesmerveillesdumaroc.png"></img></a></div>
<div style="position:absolute; right:15px; top:260px"><a href="http://www.restaurant-ugarit.com" target="_blank"><img width="140" height="80" src="images/logo/ugarit.png"></img></a></div>
<div style="position:absolute; right:15px; top:380px"><a href="http://www.labaguedekenza.com" target="_blank"><img width="140" height="80" src="images/logo/labaguedekenza.png"></img></a></div>


<!--header end of-->

